package com.example.admin.scheduler;

import com.example.admin.service.impl.ServerSentEventsServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SchedulerX2Runnable2 implements Runnable{

    private static final Logger logger = LoggerFactory.getLogger(SchedulerX2Runnable2.class);

    private ServerSentEventsServiceImpl serverSentEventServiceImpl;

    public SchedulerX2Runnable2() {
        this.serverSentEventServiceImpl = new ServerSentEventsServiceImpl();
    }

    @Override
    public void run() {
        logger.info("你好，Server-Sent Events服务器！ 欢迎来到 Server-Sent Events 世界！");
        serverSentEventServiceImpl.send();
        logger.info("SchedulerX2Runnable 定时任务: {}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}
